<template>
  <van-tag :color="bg" class="mr-5"
    ><span :style="{ color: textColor }">{{ getplatformId() }}</span></van-tag
  >
</template>

<script setup>
const props = defineProps(['info'])
const bg = ref('')
const textColor = ref('')
const list = [
  { platformId: 1, title: '淘宝', color: '#FF4401' },
  { platformId: 2, title: '京东', color: '#D6251F' },
  { platformId: 3, title: '拼多多', color: '#E22A1F' },
  { platformId: 4, title: '苏宁', color: '#FF8000' },
  { platformId: 5, title: '唯品会', color: '#F10180' },
  { platformId: 6, title: '考拉', color: '#FF2337' },
  { platformId: 7, title: '抖音', color: '#222049' },
  { platformId: 8, title: '快手', color: '#ff6c00' },
  { platformId: 9, title: '猫享', color: '#FF4401' },
  { platformId: 10, title: '阿里巴巴', color: '#FF4401' },
  { platformId: 11, title: '腾讯云选', color: '#FF4401' },
  { platformId: 12, title: '美团分销', color: '#FF4401' },
  { platformId: 13, title: '美团联盟', color: '#FF4401' },
  { platformId: 14, title: '美团美天赚', color: '#222049' },
  { platformId: 15, title: '阿里本地联盟', color: '#ff6c00' },
  { platformId: 16, title: '抖音本地联盟', color: '#FF4401' },
  {
    platformId: 17,
    title: '美团',
    color: '#ffd100',
    textColor: '#000 !important',
    desc: '团油'
  },
  { platformId: 18, title: '滴滴', color: '#049dfd' },
  { platformId: 19, title: '卡券', color: '#FF4401' },
  { platformId: 20, title: '千猪-肯德基', color: '#FF0036' },
  { platformId: 21, title: '千猪-电影票', color: '#2878ff' },
  { platformId: 22, title: '信用卡', color: '#FF4401', desc: '信用卡' },
  { platformId: 23, title: '多麦', color: '#D6251F' },
  { platformId: 24, title: '海威', color: '#FF4401' },
  {
    platformId: 25,
    title: '比价寄',
    color: '#ffd100',
    textColor: '#000 !important'
  },
  {
    platformId: 26,
    title: '电影票',
    color: '#ffd100',
    textColor: '#000 !important'
  }
]
const getplatformId = () => {
  // if (props?.info?.sourceType) {
  //   props?.info?.platformId = props?.info?.sourceType
  //     }
  if (props?.info?.platformId == 1) {
    bg.value = props?.info?.shopType == 1 ? '#FF0036' : '#FF4401'
    return props.info.shopType == 1 ? '天猫' : '淘宝'
  } else {
    bg.value = props.info.platformId && list[props.info.platformId - 0 - 1].color
    textColor.value = (props.info.platformId && list[props.info.platformId - 0 - 1].textColor) || '#fff !important'
    return props.info.platformId && list[props.info.platformId - 0 - 1].title
  }
}
</script>

<style scoped lang="scss"></style>
